﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ServiceModel;
using System.ServiceModel.Web;
using System.Runtime.Serialization;


namespace WCFServicesForCitrix.Interfaces
{
    [ServiceContract(Namespace="")]
    //[ServiceContract(Namespace = "")]
    public interface IXenServer
    {
        [OperationContract]

        [WebGet(UriTemplate = "api/{name}/",

            ResponseFormat = WebMessageFormat.Xml,

            BodyStyle = WebMessageBodyStyle.Bare,

            RequestFormat = WebMessageFormat.Xml)]

        string GetData(string name);



        [OperationContract]
        [WebInvoke(UriTemplate = "PutData/name={name}",BodyStyle=WebMessageBodyStyle.Bare)]
        string PutData(string name, ContactDetails details);
        
        /// <summary>
        /// Method that returns and AuthTicket. This method is required to authenticate you to the service before making any calls
        /// The users for now are added to the  web.config file with future implementation being in a secure database.
        /// </summary>
        /// <param name="AuthUsername"></param>
        /// <param name="AuthPassword"></param>
        /// <returns></returns>
        [OperationContract]
        //[WebGet(UriTemplate = "/GetAuthTicket/authusername={AuthUsername}&authpassword={AuthPassword}&useserversideauthentication={UseServerSideAuthentication}", ResponseFormat = WebMessageFormat.Xml)]
        [WebGet(ResponseFormat = WebMessageFormat.Xml)]
        XServer.XSAuthTicket GetAuthTicket(string AuthUsername, string AuthPassword, bool UseServerSideAuthentication);

        [OperationContract]
        [WebInvoke(UriTemplate = "/GetServerTicket?host={host}&port={port}&username={Username}&password={Password}&validate={Validate}", Method = "POST", RequestFormat = WebMessageFormat.Xml, ResponseFormat = WebMessageFormat.Xml, BodyStyle = WebMessageBodyStyle.Bare)]
        XServer.XSTicket GetServerTicket(string host, string port, string Username, string Password, string Validate, XServer.XSAuthTicket AuthTicket);
        
        //[OperationContract]
        //[WebInvoke(RequestFormat = WebMessageFormat.Xml, BodyStyle = WebMessageBodyStyle.Wrapped)]
        //string PostTest(string host);

        [OperationContract]
        [WebInvoke(UriTemplate = "/GetServers", Method = "POST", ResponseFormat = WebMessageFormat.Xml, RequestFormat = WebMessageFormat.Xml, BodyStyle = WebMessageBodyStyle.Bare)]
        List<XServer.XSServer> GetServers(XServer.XSAuthTicket AuthTicket);

        [OperationContract]
        [WebInvoke(UriTemplate = "/GetVirtualMachines", Method = "POST", RequestFormat = WebMessageFormat.Xml, BodyStyle = WebMessageBodyStyle.Bare)]
        List<XServer.XSVirtualMachine> GetVirtualMachines(XServer.XSTicket ServerTicket);

        [OperationContract]
        [WebInvoke(UriTemplate = "/GetVirtualMachineProperties", Method = "POST", RequestFormat = WebMessageFormat.Xml, BodyStyle = WebMessageBodyStyle.Wrapped)]
        XServer.XSVirtualMachineProperties GetVirtualMachineProperties(XServer.XSTicket ServerTicket, XServer.XSVirtualMachine XenVirtuaMachine);

        [OperationContract]
        [WebInvoke(UriTemplate = "/GetServerTemplates", RequestFormat = WebMessageFormat.Xml, BodyStyle = WebMessageBodyStyle.Bare)]
        List<XServer.XSVirtualMachine> GetServerTemplates(XServer.XSTicket ServerTicket);

        ////Add actions to the method signature. Find out how to add enum to interfaces!
        //[OperationContract]
        //[WebGet(ResponseFormat = WebMessageFormat.Xml)]
        //bool PerformVirtualMachineAction(XServer.XSVirtualMachine VirtualMachine, XServer.VMActions Action);

        //[OperationContract]
        //[WebGet(ResponseFormat = WebMessageFormat.Xml)]
        //XServer.VMCurrentStatus GetVirtualMachineStatus(XServer.XSVirtualMachine VirtualMachine);
        //[OperationContract]
        //[WebGet(ResponseFormat = WebMessageFormat.Xml)]
        //void PerformVirtualMachineAction(XServer.XSVirtualMachine VirtualMachine);
         


    }
    [DataContract(Namespace = "")]
    public class ContactDetails
    {
        [DataMember]
        public string SiteUrl { get; set; }
    }
}
